package ProjetCorba;

/**
 * Interface definition : Adherent
 * 
 * @author OpenORB Compiler
 */
public class _AdherentStub extends org.omg.CORBA.portable.ObjectImpl
        implements Adherent
{
    static final String[] _ids_list =
    {
        "IDL:ProjetCorba/Adherent:1.0"
    };

    public String[] _ids()
    {
     return _ids_list;
    }

    private final static Class _opsClass = ProjetCorba.AdherentOperations.class;

    /**
     * Read accessor for numAdh attribute
     * @return the attribute value
     */
    public short numAdh()
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try {
                    org.omg.CORBA.portable.OutputStream _output = this._request("_get_numAdh",true);
                    _input = this._invoke(_output);
                    return _input.read_short();
                } catch (final org.omg.CORBA.portable.RemarshalException _exception) {
                    continue;
                } catch (final org.omg.CORBA.portable.ApplicationException _exception) {
                    final String _exception_id = _exception.getId();
                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                } finally {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("_get_numAdh",_opsClass);
                if (_so == null)
                   continue;
                ProjetCorba.AdherentOperations _self = (ProjetCorba.AdherentOperations) _so.servant;
                try
                {
                    return _self.numAdh();
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation envoyerColis
     */
    public void envoyerColis(short numAdh)
        throws ProjetCorba.AdherentPackage.Adh_Inconnu
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("envoyerColis",true);
                    _output.write_short(numAdh);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    if (_exception_id.equals(ProjetCorba.AdherentPackage.Adh_InconnuHelper.id()))
                    {
                        throw ProjetCorba.AdherentPackage.Adh_InconnuHelper.read(_exception.getInputStream());
                    }

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("envoyerColis",_opsClass);
                if (_so == null)
                   continue;
                ProjetCorba.AdherentOperations _self = (ProjetCorba.AdherentOperations) _so.servant;
                try
                {
                    _self.envoyerColis( numAdh);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation retirerColis
     */
    public void retirerColis(short idAdh)
        throws ProjetCorba.AdherentPackage.Adh_Inconnu
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("retirerColis",true);
                    _output.write_short(idAdh);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    if (_exception_id.equals(ProjetCorba.AdherentPackage.Adh_InconnuHelper.id()))
                    {
                        throw ProjetCorba.AdherentPackage.Adh_InconnuHelper.read(_exception.getInputStream());
                    }

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("retirerColis",_opsClass);
                if (_so == null)
                   continue;
                ProjetCorba.AdherentOperations _self = (ProjetCorba.AdherentOperations) _so.servant;
                try
                {
                    _self.retirerColis( idAdh);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

}
